/****************************************************************************
*                                                                           *
* Copyright (c) RSC. All rights reserved(2010).								*
* Developer: Marius Ionescu    						                        *
*                                                                           *
****************************************************************************/

using System;
using System.Collections;
using System.Data;
using System.Drawing;
using System.Web.Security;
using System.Web.UI.WebControls;
using NS_Controls;
using System.Web.Services;
using System.Web.Script.Services;
using System.Web.UI;
using AjaxControlToolkit;
using System.Web;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Web.UI.DataVisualization.Charting;


public partial class TaskTrace : SessionPageBase
{

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                LoadData();
            }

        }
        catch (Exception ex)
        {
            this.SetMessage(ex.Message, true);
        }
    }

    protected void LoadData()
    {
        try
        {
            DataSet ds_Task = Hipocrate.DB.DBConnection.GetData("select * from TaskTrace");
            DataView dv = ds_Task.Tables[0].DefaultView;

            rptTask.DataSource = dv;
            rptTask.DataBind();
        }
        catch (Exception ex)
        {
            this.SetMessage(ex.Message, true);
        }
    }

    protected void rptTask_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        RepeaterItem item = e.Item;
        if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
        {
            DataRowView drv = (DataRowView)item.DataItem;
            ProgressControl progrTaskStatus = (ProgressControl)item.FindControl("progrCtrl");

            int value = Convert.ToInt32(drv["Status"]);
            progrTaskStatus.Value = value;
            progrTaskStatus.Mode = Mode.Manual;
            progrTaskStatus.Animate = true;
            if(value < 25)
                progrTaskStatus.CssClass = "red";
            else if (value > 25 && value < 50)
                progrTaskStatus.CssClass = "yelllow";
            else if (value > 50 && value < 75)
                progrTaskStatus.CssClass = "lightblue";
            else
                progrTaskStatus.CssClass = "green";
        }
    }

    protected void tabActive_TabChanged(object sender, EventArgs e)
    {

    }
}
